home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / bwb110e.zip / BWBASIC.DOC next >
Text File  |  1992-10-27  |  17KB  |  442 lines

  1.  
  2.  
  3.  
  4.  
  5.                Bywater BASIC Interpreter/Shell, version 1.10
  6.                ---------------------------------------------
  7.  
  8.                     Copyright (c) 1992, Ted A. Campbell
  9.                  for bwBASIC version 1.10, 1 November 1992
  10.  
  11.  
  12. CONTENTS:
  13.  
  14.    1. DESCRIPTION
  15.    2. TERMS OF USE
  16.    3. COMMANDS AND FUNCTIONS IMPLEMENTED
  17.    4. SOME NOTES ON USAGE
  18.    5. UNIMPLEMENTED COMMANDS AND FUNCTIONS
  19.    6. SOME NOTES ON COMPILATION
  20.    7. THE STORY OF BYWATER BASIC
  21.    8. COMMUNICATIONS
  22.  
  23.  
  24. 1. DESCRIPTION
  25.  
  26.    The Bywater BASIC Interpreter (bwBASIC) implements a large
  27.    superset of the ANSI Standard for Minimal BASIC (X3.60-1978)
  28.    in ANSI C and offers shell program facilities as an extension
  29.    of BASIC.
  30.  
  31.    The set of BASIC commands and functions implemented is fairly
  32.    limited (see section three below), although more commands and
  33.    functions are implemented than appear in the specification
  34.    for Minimal BASIC. There are no commands that are terminal- or
  35.    hardware specific. (Seriously -- CLS may work under bwBASIC
  36.    on your DOS-based pc, but that is because bwBASIC shells
  37.    out to DOS when it does not recognize CLS and executes CLS there.)
  38.  
  39.    The interpreter is slow.  Whenever faced with a choice between 
  40.    conceptual clarity and speed, I have consistently chosen
  41.    the former.  The interpreter is the simplest design available,
  42.    and utilizes no system of intermediate code, which would speed
  43.    up considerably its operation.  As it is, each line is interpreted
  44.    afresh as the interpreter comes to it. 
  45.  
  46.    bwBASIC implements one feature not available in previous BASIC
  47.    interpreters: a shell command can be entered interactively at the
  48.    bwBASIC prompt, and the interpreter will execute it under a
  49.    command shell.  For instance, the command "dir *.bas" can be
  50.    entered in bwBASIC (under DOS, or "ls -l *.bas" under UNIX) and
  51.    it will be executed as from the operating system command line.
  52.    Shell commands can also be given on numbered lines in a bwBASIC
  53.    program, so that bwBASIC can be used as a shell programming
  54.    language. bwBASIC's implementation of the RMDIR, CHDIR, MKDIR,
  55.    NAME, KILL, ENVIRON, and ENVIRON$() commands and functions
  56.    offer further shell-processing capabilities.
  57.  
  58.  
  59. 2. TERMS OF USE:
  60.  
  61.    The bwBASIC source code and executables produced from it can be
  62.    used subject to the following statement which is included in
  63.    the header to all the source code files:
  64.  
  65.         All U.S. and international copyrights are claimed by the
  66.         author. The author grants permission to use this code
  67.         and software based on it under the following conditions:
  68.         (a) in general, the code and software based upon it may be
  69.         used by individuals and by non-profit organizations; (b) it
  70.         may also be utilized by governmental agencies in any country,
  71.         with the exception of military agencies; (c) the code and/or
  72.         software based upon it may not be sold for a profit without
  73.         an explicit and specific permission from the author, except
  74.         that a minimal fee may be charged for media on which it is
  75.         copied, and for copying and handling; (d) the code must be
  76.         distributed in the form in which it has been released by the
  77.         author; and (e) the code and software based upon it may not
  78.         be used for illegal activities.
  79.  
  80.  
  81. 3. BASIC COMMANDS AND FUNCTIONS IMPLEMENTED:
  82.  
  83.    ABS( number )
  84.    ASC( string$ )
  85.    ATN( number )
  86.    CHAIN [MERGE] file-name [, line-number] [, ALL]
  87.    CHR$( number )
  88.    CINT( number )
  89.    CLEAR
  90.    CLOSE [[#]file-number]...
  91.    COMMON variable [, variable...]
  92.    COS( number )
  93.    CSNG( number )
  94.    CVD( string$ )
  95.    CVI( string$ )
  96.    CVS( string$ )
  97.    DATA constant[,constant]...
  98.    DATE$
  99.    DEF FNname(arg...)] = expression
  100.    DEFDBL letter[-letter](, letter[-letter])...
  101.    DEFINT letter[-letter](, letter[-letter])...
  102.    DEFSNG letter[-letter](, letter[-letter])...
  103.    DEFSTR letter[-letter](, letter[-letter])...
  104.    DELETE line[-line]
  105.    DIM variable(elements...)[variable(elements...)]...
  106.    END
  107.    ENVIRON variable-string = string
  108.    ENVIRON$( variable-string )
  109.    EOF( device-number )
  110.    ERASE variable[, variable]...
  111.    ERL
  112.    ERR
  113.    ERROR number
  114.    EXP( number )
  115.    FIELD [#] device-number, number AS string-variable [, number AS string-variable...]
  116.    FOR counter = start TO finish [STEP increment]
  117.    GET [#] device-number [, record-number]
  118.    GOSUB line
  119.    GOTO line
  120.    HEX$( number )
  121.    IF expression THEN statement [ELSE statement]
  122.    INPUT [# device-number]|[;]["prompt string";]list of variables
  123.    INSTR( [start-position,] string-searched$, string-pattern$ )
  124.    INT( number )
  125.    KILL file-name
  126.    LEFT$( string$, number-of-spaces )
  127.    LEN( string$ )
  128.    LET variable = expression
  129.    LINE INPUT [[#] device-number,]["prompt string";] string-variable$
  130.    LIST line[-line]
  131.    LOAD file-name
  132.    LOC( device-number )
  133.    LOF( device-number )
  134.    LOG( number )
  135.    LSET string-variable$ = expression
  136.    MERGE file-name
  137.    MID$( string$, start-position-in-string[, number-of-spaces ] )
  138.    MKD$( double-value# )
  139.    MKI$( integer-value% )
  140.    MKS$( single-value! )
  141.    NAME old-file-name AS new-file-name
  142.    NEW
  143.    NEXT counter
  144.    OCT$( number )
  145.    ON variable GOTO|GOSUB line[,line,line,...]
  146.    ON ERROR GOSUB line
  147.    OPEN O|I|R, [#]device-number, file-name [,record length]
  148.         file-name FOR INPUT|OUTPUT|APPEND AS [#]device-number [LEN = record-length]
  149.    OPTION BASE number
  150.    POS
  151.    PRINT [# device-number,][USING format-string$;] expressions...
  152.    PUT [#] device-number [, record-number]
  153.    RANDOMIZE number
  154.    READ variable[, variable]...
  155.    REM string
  156.    RESTORE line
  157.    RETURN
  158.    RIGHT$( string$, number-of-spaces )
  159.    RND( number )
  160.    RSET string-variable$ = expression
  161.    RUN [line][file-name]
  162.    SAVE file-name
  163.    SGN( number )
  164.    SIN( number )
  165.    SPACE$( number )
  166.    SPC( number )
  167.    SQR( number )
  168.    STOP
  169.    STR$( number )
  170.    STRING$( number, ascii-value|string$ )
  171.    SWAP variable, variable
  172.    SYSTEM
  173.    TAB( number )
  174.    TAN( number )
  175.    TIME$
  176.    TIMER
  177.    TROFF
  178.    TRON
  179.    VAL( string$ )
  180.    WEND
  181.    WHILE expression
  182.    WIDTH [# device-number,] number
  183.    WRITE [# device-number,] element [, element ].... 
  184.  
  185.    If DIRECTORY_CMDS is set to TRUE when the program is compiled,
  186.    then the following commands will be available:
  187.  
  188.    CHDIR pathname
  189.    MKDIR pathname
  190.    RMDIR pathname
  191.  
  192.    If DEBUG is set to TRUE when the program is compiled then
  193.    the following debugging commands (unique to bwBASIC) will
  194.    be available:
  195.  
  196.    VARS            (prints a list of all variables)
  197.    CMDS            (prints a list of all commands)
  198.    FNCS            (prints a list of all functions)
  199.  
  200.    If COMMAND_SHELL is set to TRUE when the program is compiled,
  201.    then the user may enter a shell command at the bwBASIC prompt.
  202.  
  203.  
  204. 4. SOME NOTES ON USAGE:
  205.  
  206.    An interactive environment is provided, so that a line with a
  207.    line number can be entered at the bwBASIC prompt and it will be
  208.    added to the program in memory.
  209.  
  210.    Line numbers are not strictly required, but are useful if the
  211.    interactive enviroment is used for programming.  For longer
  212.    program entry one might prefer to use an ASCII text editor, and
  213.    in this case lines can be entered without numbers. In this case,
  214.    however, one will not be able to alter the numberless lines
  215.    within the interactive environment.
  216.  
  217.    Command names and function names are not case sensitive,
  218.    so that "Run" and "RUN" and "run" are equivalent and "abs()"
  219.    and "ABS()" and "Abs()" are equivalent. HOWEVER: variable
  220.    names ARE case sensitive in bwbASIC, so that "d$" and "D$"
  221.    are different variables.  This differs from some BASIC
  222.    implementations where variable names are not case sensitive.
  223.  
  224.    A filename can be specified on the command line and will be
  225.    LOADed and RUN immediately, so that the command line
  226.  
  227.       bwbasic prog.bas
  228.  
  229.    will load and execute "prog.bas".
  230.  
  231.    All programs are stored as ASCII text files.
  232.  
  233.    TRUE is defined as -1 and FALSE is defined as 0 in